Fix check for python version on sc2json script#179
Fix check for python version on sc2json script#179manuelseeger wants to merge 4 commits intoggtracker:upstreamfrom manuelseeger:upstream
Conversation
Python3 deprecates encoding option on json.dumps and defaults to UTF8.
|
This was nonsense. Scripts still errors for me though even with the TypeError. Is the executable delivered with the pip package out of date? |
Python3 deprecates encoding option on json.dumps and defaults to UTF8. The existing try didn't work since the plugin wrapper doesn't call json.dumps until after except statement in line 41.
|
Can you please provide the stack trace for the TypeError? |
|
The existing TypeError check doesn't seem to work since the plugin wrapper doesn't invoke json dumps until after the replay is being loaded in line 41 |
|
The TypeError is thrown on factory.load_replay, not on factory.register_plugin, which is being checked. sc2reader/sc2reader/scripts/sc2json.py Line 41 in 7da58b1 |
Can you please provide the stack trace? |
|
Traceback (most recent call last): |
| args = parser.parse_args() | ||
|
|
||
| factory = sc2reader.factories.SC2Factory() | ||
| try: |
There was a problem hiding this comment.
This change above is good.
The change below is not really required because the try / except block does the same thing.
There was a problem hiding this comment.
If I would leave the original try/except it would throw an AttributeError before the TypeError though if args.encoding doesn't exist
|
If python3 doesn't support |
Yes, but we should also drop Python 2… #163 (comment) |
You already did a great job clearing out a bunch of Python 2 stuff in this PR #174 Is there more we need to do in the code to drop support, or is it just a config thing? |
|
@manuelseeger Can you please rebase this pull request or close it? |
| nargs=1, | ||
| help="Path to the replay to serialize.", | ||
| ) | ||
| if sys.version_info.major < 3: |
Python3 deprecates encoding option on json.dumps and defaults to UTF8.